<!DOCTYPE html>
<html>
<head>
    <title>FileManager</title>
    <script src="static/func.js"></script>
</head>
<body>
<div>
    <h2>
        {%- for part in path_parts -%}
        {% if loop.last %}
        {{ part.part }}
        {% else %}
        <a href="" onclick="{{ 'return openPath(\'' ~ part.path ~ '\')' }}">{{ part.part }}</a>/
        {% endif %}
        {%- endfor -%}
    </h2>
</div>
<div>
<table>
<thead>
<tr>
    <th></th><th>Name</th><th>Size</th><th>Type</th><th>Operation</th>
</tr>
</thead>
<tbody>
{% for dir in dirs %}
<tr>
    <td> <input type="checkbox" name="floder" value="{{path ~ dir.name}}" style="position:relative; top: 4px"> </td>
    <td><img src="static/folder.png" style="width: 24px;height: 24px;position: relative; top: 6px;"><a href="" onclick="{{ 'return openPath(\'' ~ path ~ dir.name ~'/\')' }}">{{ dir.name }}/</a></td>
    <td>-</td>
    <td>Directory</td>
    <td><button type="button" onclick="{{ 'deleteDir(\'' ~ path ~ dir.name ~ '/\')' }}">Delete</button>
        <button type="button" onclick="{{ 'rename(\'' ~ path ~ '\',\'' ~ dir.name ~ '\')' }}">Rename</button></td>
</tr>
{% endfor %}
{% for file in files %}
<tr>
    <td> <input type="checkbox" name="file" value="{{path ~ file.name}}"> </td>
    <td><a href="{{ download_server ~ '/' ~ path ~ file.name }}">{{ file.name }}</a></td>
    <td>{{ file.size|filesizeformat }}</td>
    <td>{{ file.mimetype }}</td>
    <td><button type="button" onclick="{{ 'deleteFile(\'' ~ path ~ file.name ~ '\')' }}">Delete</button>
        <button type="button" onclick="{{ 'rename(\'' ~ path ~ '\',\'' ~ file.name ~ '\')' }}">Rename</button>
    </td>
</tr>
{% endfor %}
<tr>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    <td><button type="button" onclick="{{ 'deleteSelected()' }}">DeleteSelected</button>
        <button type="button" onclick="{{ 'deleteAllContent(\'' ~ path ~ '\')' }}">DeleteAll</button></td>
</tr>
</tbody>
</table>
    <p>-----------------------------------------------------</p>
    <p>Disk Usage: {{ usage_str }}</p>
</div>
<p id="error_msg" style="color:red"></p>
</body>
</html>